home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / oldwish / RCS / wishGather.c,v < prev    next >
Encoding:
Text File  |  1989-07-13  |  34.7 KB  |  1,484 lines

  1. head     1.4;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    mgbaker:1.4; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.4
  10. date     89.01.11.11.31.37;  author mlgray;  state Exp;
  11. branches ;
  12. next     1.3;
  13.  
  14. 1.3
  15. date     88.11.03.19.45.06;  author mlgray;  state Exp;
  16. branches ;
  17. next     1.2;
  18.  
  19. 1.2
  20. date     88.11.02.14.50.27;  author mlgray;  state Exp;
  21. branches ;
  22. next     1.1;
  23.  
  24. 1.1
  25. date     88.10.03.12.47.47;  author mlgray;  state Exp;
  26. branches ;
  27. next     ;
  28.  
  29.  
  30. desc
  31. @X11: works pretty much now.
  32. @
  33.  
  34.  
  35. 1.4
  36. log
  37. @Temporary checkin
  38. @
  39. text
  40. @/* 
  41.  * wishGather.c --
  42.  *
  43.  *    Gathering and sorting file names.  Putting them in
  44.  *    data structures.
  45.  *
  46.  * Copyright 1987 Regents of the University of California
  47.  * All rights reserved.
  48.  * Permission to use, copy, modify, and distribute this
  49.  * software and its documentation for any purpose and without
  50.  * fee is hereby granted, provided that the above copyright
  51.  * notice appear in all copies.  The University of California
  52.  * makes no representations about the suitability of this
  53.  * software for any purpose.  It is provided "as is" without
  54.  * express or implied warranty.
  55.  */
  56.  
  57. #ifndef lint
  58. static char rcsid[] = "$Header: /a/newcmds/wish/RCS/wishGather.c,v 1.3 88/11/03 19:45:06 mlgray Exp Locker: mlgray $ SPRITE (Berkeley)";
  59. #endif not lint
  60.  
  61.  
  62. #include <sys/types.h>
  63. #include <sys/stat.h>
  64. #include <sys/dir.h>
  65. #include <errno.h>
  66. #include "sx.h"
  67. #include "string.h"
  68. #include "util.h"
  69. #include "wishInt.h"
  70.  
  71. /* ClientData for scandir select proc's */
  72. static    ClientData    scanData;
  73.  
  74. /* used before defined */
  75. extern    Boolean    SelectFiles();
  76. extern    int    AlphaForwards();
  77. extern    int    AlphaReverse();
  78. extern    int    AtimeForwards();
  79. extern    int    AtimeReverse();
  80. extern    int    CtimeForwards();
  81. extern    int    CtimeReverse();
  82. extern    int    MtimeForwards();
  83. extern    int    MtimeReverse();
  84. extern    int    DtimeForwards();
  85. extern    int    DtimeReverse();
  86. extern    int    SizeForwards();
  87. extern    int    SizeReverse();
  88. extern    int    AtimeSort();
  89. extern    int    MtimeSort();
  90. extern    int    DtimeSort();
  91. extern    int    SizeSort();
  92.  
  93.  
  94. /*
  95.  *----------------------------------------------------------------------
  96.  *
  97.  * WishGatherNames --
  98.  *
  99.  *    Using scandir() and a bunch of rules and call-back thingies,
  100.  *    gather the appropriate names into the appropriate places.
  101.  *
  102.  * Results:
  103.  *    TCL_OK if all went well.  Some TCL error if not.
  104.  *
  105.  * Side effects:
  106.  *    The names are gathered and stuff is allocated.
  107.  *
  108.  *----------------------------------------------------------------------
  109.  */
  110. int
  111. WishGatherNames(aWindow)
  112.     WishWindow    *aWindow;
  113. {
  114.     int        nitems;
  115.     struct    direct    **namelist;
  116.     int        (*compareProc)();
  117.     int        i;
  118.     WishFile    *tmpPtr, *backTmpPtr;
  119.     WishGroup    *grpPtr;
  120.     int        result;
  121.     Boolean    getAttrsP = FALSE;
  122.     struct    stat    attrs;
  123.  
  124.     if (aWindow->groupList == NULL) {
  125.     /* get it out of the file */
  126. #ifdef NOTDEF
  127.     Sx_Panic(wishDisplay,
  128.         "WishGatherNames: Should source .wish file, but can't.");
  129. #endif NOTDEF
  130. #ifdef NOTDEF
  131.     WishReadRules(aWindow, name);
  132. #endif NOTDEF
  133.     }
  134.     if (aWindow->groupList == NULL) {
  135.     /*
  136.      * There wasn't a file, select everything (or should the default
  137.      * be to select nothing?
  138.      */
  139.     aWindow->groupList = (WishGroup *) malloc(sizeof (WishGroup));
  140.     aWindow->groupList->myColumn = -1;
  141.     aWindow->groupList->headerWindow = UNINITIALIZED;
  142.     aWindow->groupList->x = aWindow->groupList->y = -1;
  143.     aWindow->groupList->width = aWindow->groupList->height = -1;
  144.     aWindow->groupList->entry_x = aWindow->groupList->entry_y =
  145.         aWindow->groupList->entry_width = -1;
  146.     aWindow->groupList->fileList = NULL;
  147.     aWindow->groupList->defType = COMPARISON;
  148.     aWindow->groupList->rule = Util_Strcpy(NULL, "*");
  149.     aWindow->groupList->groupBindings = NULL;
  150.     aWindow->groupList->length = -1;
  151.     aWindow->groupList->selectedP = FALSE;
  152.     aWindow->groupList->highlightP = FALSE;
  153.     aWindow->groupList->nextPtr = NULL;
  154.  
  155.     aWindow->numElements = UNINITIALIZED;
  156.     aWindow->numGroups = 1;
  157.     aWindow->numHiddenGroups = 0;
  158.     }
  159.     if (aWindow->numElements >= 0) {
  160.     /*
  161.      * For now, this means this has already been set up, since there's
  162.      * no garbage collection yet.
  163.      */
  164.     return TCL_OK;
  165.     }
  166.     WishGetCompareProc(aWindow, &compareProc, FALSE);
  167.     getAttrsP = WISH_ATTR_NECESSARY_P; 
  168.  
  169.     scanData = (ClientData) aWindow;
  170.     nitems = scandir(aWindow->dir, &namelist, SelectFiles, compareProc);
  171.     /*
  172.      * I use Stat_GetMsg here.  Am I doing it correctly with errno?
  173.      */
  174.     if (nitems < 0) {
  175.     sprintf(aWindow->interp->result, "%s %s %s %s.  %s %s",
  176.         "Directory scan failed in", aWindow->dir, "with error",
  177.         Stat_GetMsg(errno),
  178.         "Either the directory doesn't exist, or it",
  179.         "is unreadable, or we've run out of memory");
  180.     return TCL_ERROR;
  181.     }
  182.     /*
  183.      * For each file, run through all the groups putting a copy of the file
  184.      * into the group if it matches the rule for that group.  This allows
  185.      * one file to show up in all groups that can select it.  If files should
  186.      * only show up in one place, then skip to the next file after we've
  187.      * found one group for it.  Right now, I use the first policy.  Maybe
  188.      * this should be an option.
  189.      *
  190.      * Since the files are in proper sorted order already and I run through
  191.      * them in order, they will come out in proper sorted order inside the
  192.      * groups.
  193.      *
  194.      * NOTE:  This may be way too slow to use Pattern_Match() in 2 passes
  195.      * like this.
  196.      */
  197.     aWindow->numElements = 0;        /* since it's initialized to -1 */
  198.     aWindow->numHiddenGroups = 0;
  199.     for (i = 0; i < nitems; i++) {
  200.     if (getAttrsP) {
  201.         /*
  202.          * If the files were sorted by something involving an attribute,
  203.          * then there should be a way in the sort routines to cache that
  204.          * info so we don't do a second GetAttributes()'s here...
  205.          * This means dealing with the garbage collection aspects too.
  206.          */
  207.         if (lstat(namelist[i]->d_name, &attrs)
  208.             != 0) {
  209.         char    buffer[MAXPATHLEN];
  210.         sprintf(wishErrorMsg, "%s %s.  %s %s.  %s %s.",
  211.             "Couldn't get attributes for file",
  212.             namelist[i]->d_name,
  213.             "Error was",
  214.             Stat_GetMsg(errno),
  215.             "Current dir is",
  216.             getwd(buffer) == NULL ? "NULL" : buffer);
  217.         aWindow->notifierP = TRUE;
  218.         Sx_Notify(wishDisplay, aWindow->surroundingWindow, -1, -1, 0,
  219.             wishErrorMsg,
  220.             NULL, TRUE, "Skip offending file", (char *) NULL);
  221.         aWindow->notifierP = FALSE;
  222.         continue;
  223.         }
  224.     }
  225.     for (grpPtr = aWindow->groupList; grpPtr != NULL;
  226.         grpPtr = grpPtr->nextPtr) {
  227.         result = Pattern_Match(grpPtr->rule, namelist[i]->d_name);
  228.         if (result == 0) {        /* it matched */
  229.         tmpPtr = (WishFile *) malloc(sizeof (WishFile));
  230.         tmpPtr->name = Util_Strcpy(NULL, namelist[i]->d_name);
  231.         if (getAttrsP) {
  232.             tmpPtr->attrPtr = (struct    stat *)
  233.                 malloc(sizeof (struct    stat));
  234.             *(tmpPtr->attrPtr) = attrs;
  235.         } else {
  236.             tmpPtr->attrPtr = NULL;
  237.         }
  238.         tmpPtr->length = -1;
  239.         tmpPtr->x = tmpPtr->y = -1;
  240.         tmpPtr->myColumn = -1;
  241.         tmpPtr->selectedP = FALSE;
  242.         tmpPtr->lineP = FALSE;
  243.         tmpPtr->highlightP = FALSE;
  244.         tmpPtr->myGroupPtr = grpPtr;
  245.         tmpPtr->nextPtr = NULL;
  246.         if (grpPtr->fileList == NULL) {
  247.             grpPtr->fileList = tmpPtr;
  248.         } else {
  249.             /* add file to end of list */
  250.             for (backTmpPtr = grpPtr->fileList;
  251.                 backTmpPtr->nextPtr != NULL;
  252.                 backTmpPtr = backTmpPtr->nextPtr) {
  253.             /* do nothing */
  254.             }
  255.             backTmpPtr->nextPtr = tmpPtr;
  256.         }
  257.         aWindow->numElements++;
  258.         } else if (result < 0) {
  259.         /*
  260.          * I check the rules as they are created, or the following
  261.          * would cause a billion notifiers!  This is just for extreme
  262.          * caution...
  263.          */
  264.         sprintf(wishErrorMsg, "The rule %s contains an error.",
  265.             grpPtr->rule);
  266.         aWindow->notifierP = TRUE;
  267.         Sx_Notify(wishDisplay, aWindow->displayWindow, -1, -1, 0,
  268.             wishErrorMsg, NULL, TRUE, "Continue", NULL);
  269.         aWindow->notifierP = FALSE;
  270.         }
  271.     }
  272.     }
  273.     if (aWindow->hideEmptyGroupsP) {
  274.     for (grpPtr = aWindow->groupList; grpPtr != NULL;
  275.         grpPtr = grpPtr->nextPtr) {
  276.         if (grpPtr->fileList == NULL) {
  277.         aWindow->numHiddenGroups++;
  278.         }
  279.     }
  280.     }
  281.     /*
  282.      * total number of things that could be displayed is the number of files
  283.      * plus the number of visible group headers plus the number of spaces
  284.      * between visible groups.
  285.      */
  286.     aWindow->totalDisplayEntries = aWindow->numElements +
  287.         (2 * (aWindow->numGroups - aWindow->numHiddenGroups)) - 1;
  288.     free_scandir(nitems, &namelist);
  289.  
  290.     return TCL_OK;
  291. }
  292.  
  293. typedef    struct    {
  294.     WishWindow    *aWindow;
  295.     WishGroup        *grpPtr;
  296. } GatherInfo;
  297.  
  298.  
  299. /*
  300.  *----------------------------------------------------------------------
  301.  *
  302.  * WishGatherSingleGroup --
  303.  *
  304.  *    Using scandir() and a bunch of rules and call-back thingies,
  305.  *    gather the appropriate names into the appropriate places.
  306.  *
  307.  * Results:
  308.  *    TCL_OK if all went well.  Some TCL error if not.
  309.  *
  310.  * Side effects:
  311.  *    The names are gathered and stuff is allocated.
  312.  *
  313.  *----------------------------------------------------------------------
  314.  */
  315. int
  316. WishGatherSingleGroup(aWindow, grpPtr)
  317.     WishWindow    *aWindow;
  318.     WishGroup        *grpPtr;
  319. {
  320.     Boolean    getAttrsP = FALSE;
  321.     int        nitems;
  322.     struct    direct    **namelist;
  323.     int        (*compareProc)();
  324.     struct    stat    attrs;
  325.     WishFile    *tmpPtr, *backTmpPtr;
  326.     extern    Boolean    SelectGroupFiles();    /* forward reference */
  327.     int        i;
  328.     GatherInfo    gatherInfo;
  329.  
  330.     WishGetCompareProc(aWindow, &compareProc, FALSE);
  331.     getAttrsP = WISH_ATTR_NECESSARY_P; 
  332.  
  333.     gatherInfo.aWindow = aWindow;
  334.     gatherInfo.grpPtr = grpPtr;
  335.     scanData = (ClientData) &gatherInfo;
  336.     nitems = scandir(aWindow->dir, &namelist, SelectGroupFiles, compareProc);
  337.     if (nitems < 0) {
  338.     sprintf(aWindow->interp->result, "%s %s %s %s.  %s %s",
  339.         "Directory scan failed in", aWindow->dir, "with error",
  340.         Stat_GetMsg(errno),
  341.         "Either the direcotry doesn't exist, or it",
  342.         "is unreadable, or we've run out of memory");
  343.     return TCL_ERROR;
  344.     }
  345.     /* since they're initialized to -1 */
  346.     if (aWindow->numElements == UNINITIALIZED) {
  347.     aWindow->numElements = 0;
  348.     }
  349.     if (aWindow->numHiddenGroups == UNINITIALIZED) {
  350.     aWindow->numHiddenGroups = 0;
  351.     }
  352.     for (i = 0; i < nitems; i++) {
  353.     if (getAttrsP) {
  354.         /*
  355.          * If the files were sorted by something involving an attribute,
  356.          * then there should be a way in the sort routines to cache that
  357.          * info so we don't do a second GetAttributes()'s here...
  358.          * This means dealing with the garbage collection aspects too.
  359.          */
  360.         if (lstat(namelist[i]->d_name, &attrs)
  361.             != 0) {
  362.         char    buffer[MAXPATHLEN];
  363.         sprintf(wishErrorMsg, "%s %s.  %s %s.  %s %s.",
  364.             "Couldn't get attributes for file",
  365.             namelist[i]->d_name,
  366.             "Error was",
  367.             Stat_GetMsg(errno),
  368.             "Current dir is",
  369.             getwd(buffer) == NULL ? "NULL" : buffer);
  370.         aWindow->notifierP = TRUE;
  371.         Sx_Notify(wishDisplay, aWindow->surroundingWindow, -1, -1, 0,
  372.             wishErrorMsg,
  373.             NULL, TRUE, "Leave attributes blank", (char *) NULL);
  374.         aWindow->notifierP = FALSE;
  375.         bzero(&attrs, sizeof (struct    stat));;
  376.         }
  377.     }
  378.     tmpPtr = (WishFile *) malloc(sizeof (WishFile));
  379.     tmpPtr->name = Util_Strcpy(NULL, namelist[i]->d_name);
  380.     if (getAttrsP) {
  381.         tmpPtr->attrPtr = (struct    stat *)
  382.             malloc(sizeof (struct    stat));
  383.         *(tmpPtr->attrPtr) = attrs;
  384.     } else {
  385.         tmpPtr->attrPtr = NULL;
  386.     }
  387.     tmpPtr->length = -1;
  388.     tmpPtr->x = tmpPtr->y = -1;
  389.     tmpPtr->myColumn = -1;
  390.     tmpPtr->selectedP = FALSE;
  391.     tmpPtr->lineP = FALSE;
  392.     tmpPtr->highlightP = FALSE;
  393.     tmpPtr->myGroupPtr = grpPtr;
  394.     tmpPtr->nextPtr = NULL;
  395.     if (grpPtr->fileList == NULL) {
  396.         grpPtr->fileList = tmpPtr;
  397.     } else {
  398.         /* add file to end of list */
  399.         for (backTmpPtr = grpPtr->fileList;
  400.             backTmpPtr->nextPtr != NULL;
  401.             backTmpPtr = backTmpPtr->nextPtr) {
  402.         /* do nothing */
  403.         }
  404.         backTmpPtr->nextPtr = tmpPtr;
  405.     }
  406.     aWindow->numElements++;
  407.     }
  408.     if (aWindow->numGroups == UNINITIALIZED) {
  409.     aWindow->numGroups = 1;
  410.     aWindow->numHiddenGroups = 0;
  411.     } else {
  412.     aWindow->numGroups++;
  413.     }
  414.     if (aWindow->hideEmptyGroupsP) {
  415.     if (grpPtr->fileList == NULL) {
  416.         aWindow->numHiddenGroups++;
  417.     }
  418.     }
  419.     /*
  420.      * Total number of things that could be displayed is the number of files
  421.      * plus the number of visible group headers plus the number of spaces
  422.      * between visible groups.
  423.      */
  424.     aWindow->totalDisplayEntries = aWindow->numElements +
  425.         (2 * (aWindow->numGroups - aWindow->numHiddenGroups)) - 1;
  426.     free_scandir(nitems, &namelist);
  427.  
  428.     return TCL_OK;
  429. }
  430.  
  431.  
  432. /*
  433.  *----------------------------------------------------------------------
  434.  *
  435.  * SelectFiles --
  436.  *
  437.  *    Routine passed to scandir(). 
  438.  *
  439.  * Results:
  440.  *    Return TRUE or FALSE depending
  441.  *    upon whether or not there's a group with a rule that would
  442.  *    select this the given file.
  443.  *
  444.  * Side effects:
  445.  *    None.
  446.  *
  447.  *----------------------------------------------------------------------
  448.  */
  449. Boolean
  450. SelectFiles(entryPtr)
  451.     struct    direct    *entryPtr;
  452. {
  453.     WishWindow    *aWindow;
  454.     WishGroup        *grpPtr;
  455.     int            result;
  456.  
  457.     aWindow = (WishWindow *) scanData;
  458.     for (grpPtr = aWindow->groupList; grpPtr != NULL;
  459.         grpPtr = grpPtr->nextPtr) {
  460.     result = Pattern_Match(grpPtr->rule, entryPtr->d_name);
  461.     if (result == 0) {
  462.         break;
  463.     } else if (result < 0) {
  464.         /*
  465.          * I must check the rules as they are created, or the following
  466.          * would cause a billion notifiers!
  467.          */
  468.         sprintf(wishErrorMsg, "The rule %s contains an error.",
  469.         grpPtr->rule);
  470.         aWindow->notifierP = TRUE;
  471.         Sx_Notify(wishDisplay, aWindow->displayWindow, -1, -1, 0,
  472.             wishErrorMsg, NULL, TRUE, "Continue", NULL);
  473.         aWindow->notifierP = FALSE;
  474.     }
  475.     }
  476.     if (grpPtr == NULL) {
  477.     return FALSE;
  478.     }
  479.     return TRUE;
  480. }
  481.  
  482.  
  483. /*
  484.  *----------------------------------------------------------------------
  485.  *
  486.  * SelectGroupFiles --
  487.  *
  488.  *    Routine passed to scandir() for selecting files for a single group. 
  489.  *
  490.  * Results:
  491.  *    Return TRUE or FALSE depending
  492.  *    upon whether or not the given group rule will select the given file.
  493.  *
  494.  * Side effects:
  495.  *    None.
  496.  *
  497.  *----------------------------------------------------------------------
  498.  */
  499. Boolean
  500. SelectGroupFiles(entryPtr)
  501.     struct    direct    *entryPtr;
  502. {
  503.     WishGroup        *grpPtr;
  504.     int            result;
  505.     WishWindow    *aWindow;
  506.  
  507.     aWindow = ((GatherInfo *) scanData)->aWindow;
  508.     grpPtr = ((GatherInfo *) scanData)->grpPtr;
  509.     if (grpPtr->defType == COMPARISON) {
  510.     result = Pattern_Match(grpPtr->rule, entryPtr->d_name);
  511.     if (result == 0) {
  512.         return TRUE;
  513.     } else if (result < 0) {
  514.         sprintf(wishErrorMsg, "The rule %s contains an error.",
  515.         grpPtr->rule);
  516.         aWindow->notifierP = TRUE;
  517.         Sx_Notify(wishDisplay, aWindow->displayWindow, -1, -1, 0,
  518.             wishErrorMsg, NULL, TRUE, "Continue", NULL);
  519.         aWindow->notifierP = FALSE;
  520.     }
  521.     return FALSE;
  522.     }
  523.     if (grpPtr->defType != PROC) {
  524.     aWindow->notifierP = TRUE;
  525.     Sx_Notify(wishDisplay, aWindow->displayWindow, -1, -1, 0,
  526.         "unknown type of rule definition", NULL,
  527.         TRUE, "Continue", NULL);
  528.     aWindow->notifierP = FALSE;
  529.     return FALSE;
  530.     }
  531.     if (WishDoTclSelect(aWindow->interp, grpPtr->rule, entryPtr->d_name,
  532.         &result) != TCL_OK) {
  533.     aWindow->notifierP = TRUE;
  534.     Sx_Notify(wishDisplay, aWindow->displayWindow, -1, -1, 0,
  535.         aWindow->interp->result, NULL, TRUE, "Continue", NULL);
  536.     aWindow->notifierP = FALSE;
  537.     return FALSE;
  538.     }
  539.     return result;
  540. }
  541.  
  542.  
  543. /*
  544.  *----------------------------------------------------------------------
  545.  *
  546.  * WishDoTclSelect --
  547.  *
  548.  *    Execute the tcl rule procName on the fileName arg and determine
  549.  *    whether the file matches the rule.
  550.  *
  551.  * Results:
  552.  *    TCL_OK if things work ok, and TCL_ERROR if not.  If the routine
  553.  *    returns TCL_OK, then boolean value
  554.  *    determining whether the file matches the rule is returned in the
  555.  *    selectValPtr parameter.
  556.  *
  557.  * Side effects:
  558.  *    None.
  559.  *
  560.  *----------------------------------------------------------------------
  561.  */
  562. int
  563. WishDoTclSelect(interp, procName, arg, selectValPtr)
  564.     Tcl_Interp        *interp;
  565.     char        *procName;
  566.     char        *arg;
  567.     int            *selectValPtr;
  568. {
  569.     char    *buffer;
  570.     char    *cPtr;
  571.  
  572.     if (procName == NULL || arg == NULL) {
  573.     strcpy(interp->result,
  574.         "Null procedure name or argument for file selection");
  575.     return TCL_ERROR;
  576.     }
  577.     buffer = (char *) malloc(strlen(procName) + strlen(arg) + 2);
  578.     sprintf(buffer, "%s %s", procName, arg);
  579.     if (Tcl_Eval(interp, buffer, '\0', NULL) != TCL_OK) {
  580.     sprintf(interp->result,
  581.         "Something is wrong with the rule definition %s.", procName);
  582.     free(buffer);
  583.     return TCL_ERROR;
  584.     }
  585.     free(buffer);
  586.     if ((*selectValPtr = strtol(interp->result, &cPtr, 10)) == 0
  587.         && cPtr == interp->result) {
  588.     sprintf(interp->result, "Bad proc definition %s", procName);
  589.     return TCL_ERROR;
  590.     }
  591.     if (*selectValPtr < 0) {
  592.     sprintf(interp->result, "proc %s returned an error value", procName);
  593.     return TCL_ERROR;
  594.     }
  595.     /* reverse the meaning, since pattern match returns 0 for success... */
  596.     if (*selectValPtr == 0) {
  597.     *selectValPtr = 1;
  598.     } else {
  599.     *selectValPtr = 0;
  600.     }
  601.     return TCL_OK;
  602. }
  603.  
  604.  
  605. /*
  606.  *----------------------------------------------------------------------
  607.  *
  608.  * AlphaForwards --
  609.  *
  610.  *    Compare two files for alphabetical order.
  611.  *
  612.  * Results:
  613.  *    Negative if the first is before the second.  Zero if they are the
  614.  *    same.  Positive if the first is after the second.
  615.  *
  616.  * Side effects:
  617.  *    None.
  618.  *
  619.  *----------------------------------------------------------------------
  620.  */
  621. int
  622. AlphaForwards(first, second)
  623.     struct    direct    **first, **second;
  624. {
  625.     return alphasort(first, second);
  626. }
  627.  
  628.  
  629. /*
  630.  *----------------------------------------------------------------------
  631.  *
  632.  * AlphaReverse --
  633.  *
  634.  *    Compare two files for reverse alphabetical order.
  635.  *
  636.  * Results:
  637.  *    Negative if the first is before the second.  Zero if they are the
  638.  *    same.  Positive if the first is after the second.
  639.  *
  640.  * Side effects:
  641.  *    None.
  642.  *
  643.  *----------------------------------------------------------------------
  644.  */
  645. int
  646. AlphaReverse(first, second)
  647.     struct    direct    **first, **second;
  648. {
  649.     return (-alphasort(first, second));
  650. }
  651.  
  652.  
  653. int
  654. AtimeForwards(first, second)
  655.     struct    direct    **first, **second;
  656. {
  657.     return AtimeSort(first, second);
  658. }
  659.  
  660. int
  661. AtimeReverse(first, second)
  662.     struct    direct    **first, **second;
  663. {
  664.     return (-AtimeSort(first, second));
  665. }
  666.  
  667. #ifdef NOTDEF
  668. int
  669. CtimeForwards(first, second)
  670.     struct    direct    **first, **second;
  671. {
  672.     return CtimeSort(first, second);
  673. }
  674.  
  675. int
  676. CtimeReverse(first, second)
  677.     struct    direct    **first, **second;
  678. {
  679.     return (-CtimeSort(first, second));
  680. }
  681. #endif /* NOTDEF */
  682.  
  683. int
  684. MtimeForwards(first, second)
  685.     struct    direct    **first, **second;
  686. {
  687.     return MtimeSort(first, second);
  688. }
  689.  
  690. int
  691. MtimeReverse(first, second)
  692.     struct    direct    **first, **second;
  693. {
  694.     return (-MtimeSort(first, second));
  695. }
  696.  
  697. int
  698. DtimeForwards(first, second)
  699.     struct    direct    **first, **second;
  700. {
  701.     return DtimeSort(first, second);
  702. }
  703.  
  704. int
  705. DtimeReverse(first, second)
  706.     struct    direct    **first, **second;
  707. {
  708.     return (-DtimeSort(first, second));
  709. }
  710.  
  711. int
  712. SizeForwards(first, second)
  713.     struct    direct    **first, **second;
  714. {
  715.     return SizeSort(first, second);
  716. }
  717.  
  718. int
  719. SizeReverse(first, second)
  720.     struct    direct    **first, **second;
  721. {
  722.     return (-SizeSort(first, second));
  723. }
  724.  
  725. static int
  726. FileAlphaSort(file1, file2)
  727.     WishFile    **file1;
  728.     WishFile    **file2;
  729. {
  730.     return strcmp((*file1)->name, (*file2)->name);
  731. }
  732.  
  733. static int
  734. FileAlphaReverseSort(file1, file2)
  735.     WishFile    **file1;
  736.     WishFile    **file2;
  737. {
  738.     return (-strcmp((*file1)->name, (*file2)->name));
  739. }
  740.  
  741. static int
  742. AtimeCompare(attrs1, attrs2)
  743.     struct    stat    *attrs1;
  744.     struct    stat    *attrs2;
  745. {
  746.     if (attrs1->st_atime > attrs2->st_atime) {
  747.     return -1;
  748.     }
  749.     if (attrs1->st_atime< attrs2->st_atime) {
  750.     return 1;
  751.     }
  752. #ifdef NOTDEF
  753.     /*
  754.      * What to do about this?  Sprite gives microseconds as well as
  755.      * seconds...
  756.      */
  757.     if (attrs1->st_atime.microseconds > attrs2->st_atime.microseconds) {
  758.     return -1;
  759.     }
  760.     if (attrs1->st_atime.microseconds < attrs2->st_atime.microseconds) {
  761.     return 1;
  762.     }
  763. #endif /* NOTDEF */
  764.     return 0;
  765. }
  766.  
  767. static int
  768. FileAtimeSort(file1, file2)
  769.     WishFile    **file1;
  770.     WishFile    **file2;
  771. {
  772.     return AtimeCompare((*file1)->attrPtr, (*file2)->attrPtr);
  773. }
  774.  
  775. static int
  776. FileAtimeReverseSort(file1, file2)
  777.     WishFile    **file1;
  778.     WishFile    **file2;
  779. {
  780.     return (-AtimeCompare((*file1)->attrPtr, (*file2)->attrPtr));
  781. }
  782.  
  783. static    int
  784. AtimeSort(d1, d2)
  785.     struct    direct    **d1, **d2;
  786. {
  787.     struct    stat    attrs1;
  788.     struct    stat    attrs2;
  789.  
  790.     if (lstat((*d1)->d_name, &attrs1) != 0) {
  791.     sprintf(wishErrorMsg, "Couldn't get attributes for %s.",
  792.         (*d1)->d_name);
  793.     /* Is panic the right thing? */
  794.     Sx_Panic(wishDisplay, wishErrorMsg);
  795.     }
  796.     if (lstat((*d2)->d_name, &attrs2) != 0) {
  797.     sprintf(wishErrorMsg, "Couldn't get attributes for %s.",
  798.         (*d2)->d_name);
  799.     /* Is panic the right thing? */
  800.     Sx_Panic(wishDisplay, wishErrorMsg);
  801.     }
  802.     return AtimeCompare(&attrs1, &attrs2);
  803.  
  804. }
  805.  
  806. #ifdef NOTDEF
  807. static int
  808. CtimeCompare(attrs1, attrs2)
  809.     struct    stat    *attrs1;
  810.     struct    stat    *attrs2;
  811. {
  812.     if (attrs1->createTime.seconds > attrs2->createTime.seconds) {
  813.     return -1;
  814.     }
  815.     if (attrs1->createTime.seconds < attrs2->createTime.seconds) {
  816.     return 1;
  817.     }
  818.     if (attrs1->createTime.microseconds > attrs2->createTime.microseconds) {
  819.     return -1;
  820.     }
  821.     if (attrs1->createTime.microseconds < attrs2->createTime.microseconds) {
  822.     return 1;
  823.     }
  824.     return 0;
  825. }
  826.  
  827. static int
  828. FileCtimeSort(file1, file2)
  829.     WishFile    **file1;
  830.     WishFile    **file2;
  831. {
  832.     return CtimeCompare((*file1)->attrPtr, (*file2)->attrPtr);
  833. }
  834.  
  835. static int
  836. FileCtimeReverseSort(file1, file2)
  837.     WishFile    **file1;
  838.     WishFile    **file2;
  839. {
  840.     return (-CtimeCompare((*file1)->attrPtr, (*file2)->attrPtr));
  841. }
  842.  
  843. static    int
  844. CtimeSort(d1, d2)
  845.     struct    direct    **d1, **d2;
  846. {
  847.     struct    stat    attrs1;
  848.     struct    stat    attrs2;
  849.  
  850.     if (lstat((*d1)->d_name, &attrs1) != 0) {
  851.     sprintf(wishErrorMsg, "Couldn't get attributes for %s.",
  852.         (*d1)->d_name);
  853.     /* Is panic the right thing? */
  854.     Sx_Panic(wishDisplay, wishErrorMsg);
  855.     }
  856.     if (lstat((*d2)->d_name, &attrs2) != 0) {
  857.     sprintf(wishErrorMsg, "Couldn't get attributes for %s.",
  858.         (*d2)->d_name);
  859.     /* Is panic the right thing? */
  860.     Sx_Panic(wishDisplay, wishErrorMsg);
  861.     }
  862.     return CtimeCompare(&attrs1, &attrs2);
  863. }
  864. #endif /* NOTDEF */
  865.  
  866. static int
  867. MtimeCompare(attrs1, attrs2)
  868.     struct    stat    *attrs1;
  869.     struct    stat    *attrs2;
  870. {
  871.     if (attrs1->st_mtime > attrs2->st_mtime) {
  872.     return -1;
  873.     }
  874.     if (attrs1->st_mtime < attrs2->st_mtime) {
  875.     return 1;
  876.     }
  877. #ifdef NOTDEF
  878.     if (attrs1->dataModifyTime.microseconds >
  879.         attrs2->dataModifyTime.microseconds) {
  880.     return -1;
  881.     }
  882.     if (attrs1->dataModifyTime.microseconds <
  883.         attrs2->dataModifyTime.microseconds) {
  884.     return 1;
  885.     }
  886. #endif /* NOTDEF */
  887.     return 0;
  888. }
  889.  
  890. static int
  891. FileMtimeSort(file1, file2)
  892.     WishFile    **file1;
  893.     WishFile    **file2;
  894. {
  895.     return MtimeCompare((*file1)->attrPtr, (*file2)->attrPtr);
  896. }
  897.  
  898. static int
  899. FileMtimeReverseSort(file1, file2)
  900.     WishFile    **file1;
  901.     WishFile    **file2;
  902. {
  903.     return (-MtimeCompare((*file1)->attrPtr, (*file2)->attrPtr));
  904. }
  905.  
  906. static    int
  907. MtimeSort(d1, d2)
  908.     struct    direct    **d1, **d2;
  909. {
  910.     struct    stat    attrs1;
  911.     struct    stat    attrs2;
  912.  
  913.     if (lstat((*d1)->d_name, &attrs1) != 0) {
  914.     sprintf(wishErrorMsg, "Couldn't get attributes for %s.",
  915.         (*d1)->d_name);
  916.     /* Is panic the right thing? */
  917.     Sx_Panic(wishDisplay, wishErrorMsg);
  918.     }
  919.     if (lstat((*d2)->d_name, &attrs2) != 0) {
  920.     sprintf(wishErrorMsg, "Couldn't get attributes for %s.",
  921.         (*d2)->d_name);
  922.     /* Is panic the right thing? */
  923.     Sx_Panic(wishDisplay, wishErrorMsg);
  924.     }
  925.     return MtimeCompare(&attrs1, &attrs2);
  926. }
  927.  
  928. static int
  929. DtimeCompare(attrs1, attrs2)
  930.     struct    stat    *attrs1;
  931.     struct    stat    *attrs2;
  932. {
  933.     if (attrs1->st_ctime > attrs2->st_ctime) {
  934.     return -1;
  935.     }
  936.     if (attrs1->st_ctime < attrs2->st_ctime) {
  937.     return 1;
  938.     }
  939. #ifdef NOTDEF
  940.     if (attrs1->st_ctime.microseconds > attrs2->st_ctime.microseconds) {
  941.     return -1;
  942.     }
  943.     if (attrs1->st_ctime.microseconds < attrs2->st_ctime.microseconds) {
  944.     return 1;
  945.     }
  946. #endif /* NOTDEF */
  947.     return 0;
  948. }
  949.  
  950. static int
  951. FileDtimeSort(file1, file2)
  952.     WishFile    **file1;
  953.     WishFile    **file2;
  954. {
  955.     return DtimeCompare((*file1)->attrPtr, (*file2)->attrPtr);
  956. }
  957.  
  958. static int
  959. FileDtimeReverseSort(file1, file2)
  960.     WishFile    **file1;
  961.     WishFile    **file2;
  962. {
  963.     return (-DtimeCompare((*file1)->attrPtr, (*file2)->attrPtr));
  964. }
  965.  
  966. static    int
  967. DtimeSort(d1, d2)
  968.     struct    direct    **d1, **d2;
  969. {
  970.     struct    stat    attrs1;
  971.     struct    stat    attrs2;
  972.  
  973.     if (lstat((*d1)->d_name, &attrs1) != 0) {
  974.     sprintf(wishErrorMsg, "Couldn't get attributes for %s.",
  975.         (*d1)->d_name);
  976.     /* Is panic the right thing? */
  977.     Sx_Panic(wishDisplay, wishErrorMsg);
  978.     }
  979.     if (lstat((*d2)->d_name, &attrs2) != 0) {
  980.     sprintf(wishErrorMsg, "Couldn't get attributes for %s.",
  981.         (*d2)->d_name);
  982.     /* Is panic the right thing? */
  983.     Sx_Panic(wishDisplay, wishErrorMsg);
  984.     }
  985.     return DtimeCompare(&attrs1, &attrs2);
  986. }
  987.  
  988. static int
  989. SizeCompare(attrs1, attrs2)
  990.     struct    stat    *attrs1;
  991.     struct    stat    *attrs2;
  992. {
  993.     if (attrs1->st_size > attrs2->st_size) {
  994.     return 1;
  995.     }
  996.     if (attrs1->st_size < attrs2->st_size) {
  997.     return -1;
  998.     }
  999.     return 0;
  1000. }
  1001.  
  1002. static int
  1003. FileSizeSort(file1, file2)
  1004.     WishFile    **file1;
  1005.     WishFile    **file2;
  1006. {
  1007.     return SizeCompare((*file1)->attrPtr, (*file2)->attrPtr);
  1008. }
  1009.  
  1010. static int
  1011. FileSizeReverseSort(file1, file2)
  1012.     WishFile    **file1;
  1013.     WishFile    **file2;
  1014. {
  1015.     return (-SizeCompare((*file1)->attrPtr, (*file2)->attrPtr));
  1016. }
  1017.  
  1018. static    int
  1019. SizeSort(d1, d2)
  1020.     struct    direct    **d1, **d2;
  1021. {
  1022.     struct    stat    attrs1;
  1023.     struct    stat    attrs2;
  1024.  
  1025.     if (lstat((*d1)->d_name, &attrs1) != 0) {
  1026.     sprintf(wishErrorMsg, "Couldn't get attributes for %s.",
  1027.         (*d1)->d_name);
  1028.     /* Is panic the right thing? */
  1029.     Sx_Panic(wishDisplay, wishErrorMsg);
  1030.     }
  1031.     if (lstat((*d2)->d_name, &attrs2) != 0) {
  1032.     sprintf(wishErrorMsg, "Couldn't get attributes for %s.",
  1033.         (*d2)->d_name);
  1034.     /* Is panic the right thing? */
  1035.     Sx_Panic(wishDisplay, wishErrorMsg);
  1036.     }
  1037.     return SizeCompare(&attrs1, &attrs2);
  1038. }
  1039.  
  1040.  
  1041. /*
  1042.  *----------------------------------------------------------------------
  1043.  *
  1044.  * WishGetCompareProc --
  1045.  *
  1046.  *    Figure out what the comparison routine is and return it in
  1047.  *    the compareProc parameter.
  1048.  *    If fileProcP is true, return a function that takes pointers
  1049.  *    to WishFiles.  Otherwise it takes struct    direct's.
  1050.  *
  1051.  * Results:
  1052.  *    None.
  1053.  *
  1054.  * Side effects:
  1055.  *    None.
  1056.  *
  1057.  *----------------------------------------------------------------------
  1058.  */
  1059. void
  1060. WishGetCompareProc(aWindow, compareProcPtr, fileProcP)
  1061.     WishWindow    *aWindow;
  1062.     int    (**compareProcPtr)();
  1063.     Boolean        fileProcP;    /* which comp func type */
  1064. {
  1065.     if (aWindow->sortingInstructions == 0) {
  1066.     aWindow->sortingInstructions = WISH_ALPHA_SORT;    /* default */
  1067.     }
  1068.     if (aWindow->sortingInstructions & WISH_REVERSE_SORT) {
  1069.     if (aWindow->sortingInstructions & WISH_ALPHA_SORT) {
  1070.         if (fileProcP) {
  1071.         *compareProcPtr = FileAlphaReverseSort;
  1072.         } else {
  1073.         *compareProcPtr = AlphaReverse;
  1074.         }
  1075.     } else if (aWindow->sortingInstructions & WISH_ATIME_SORT) {
  1076.         if (fileProcP) {
  1077.         *compareProcPtr = FileAtimeReverseSort;
  1078.         } else {
  1079.         *compareProcPtr = AtimeReverse;
  1080.         }
  1081. #ifdef NOTDEF
  1082.     } else if (aWindow->sortingInstructions & WISH_CTIME_SORT) {
  1083.         if (fileProcP) {
  1084.         *compareProcPtr = FileCtimeReverseSort;
  1085.         } else {
  1086.         *compareProcPtr = CtimeReverse;
  1087.         }
  1088. #endif NOTDEF
  1089.     } else if (aWindow->sortingInstructions & WISH_MTIME_SORT) {
  1090.         if (fileProcP) {
  1091.         *compareProcPtr = FileMtimeReverseSort;
  1092.         } else {
  1093.         *compareProcPtr = MtimeReverse;
  1094.         }
  1095.     } else if (aWindow->sortingInstructions & WISH_DTIME_SORT) {
  1096.         if (fileProcP) {
  1097.         *compareProcPtr = FileDtimeReverseSort;
  1098.         } else {
  1099.         *compareProcPtr = DtimeReverse;
  1100.         }
  1101.     } else if (aWindow->sortingInstructions & WISH_SIZE_SORT) {
  1102.         if (fileProcP) {
  1103.         *compareProcPtr = FileSizeReverseSort;
  1104.         } else {
  1105.         *compareProcPtr = SizeReverse;
  1106.         }
  1107.     }
  1108.     } else {
  1109.     if (aWindow->sortingInstructions & WISH_ALPHA_SORT) {
  1110.         if (fileProcP) {
  1111.         *compareProcPtr = FileAlphaSort;
  1112.         } else {
  1113.         *compareProcPtr = AlphaForwards;
  1114.         }
  1115.     } else if (aWindow->sortingInstructions & WISH_ATIME_SORT) {
  1116.         if (fileProcP) {
  1117.         *compareProcPtr = FileAtimeSort;
  1118.         } else {
  1119.         *compareProcPtr = AtimeForwards;
  1120.         }
  1121. #ifdef NOTDEF
  1122.     } else if (aWindow->sortingInstructions & WISH_CTIME_SORT) {
  1123.         if (fileProcP) {
  1124.         *compareProcPtr = FileCtimeSort;
  1125.         } else {
  1126.         *compareProcPtr = CtimeForwards;
  1127.         }
  1128. #endif /* NOTDEF */
  1129.     } else if (aWindow->sortingInstructions & WISH_MTIME_SORT) {
  1130.         if (fileProcP) {
  1131.         *compareProcPtr = FileMtimeSort;
  1132.         } else {
  1133.         *compareProcPtr = MtimeForwards;
  1134.         }
  1135.     } else if (aWindow->sortingInstructions & WISH_DTIME_SORT) {
  1136.         if (fileProcP) {
  1137.         *compareProcPtr = FileDtimeSort;
  1138.         } else {
  1139.         *compareProcPtr = DtimeForwards;
  1140.         }
  1141.     } else if (aWindow->sortingInstructions & WISH_SIZE_SORT) {
  1142.         if (fileProcP) {
  1143.         *compareProcPtr = FileSizeSort;
  1144.         } else {
  1145.         *compareProcPtr = SizeForwards;
  1146.         }
  1147.     }
  1148.     }
  1149.  
  1150.     return;
  1151. }
  1152. @
  1153.  
  1154.  
  1155. 1.3
  1156. log
  1157. @Fixed many bugs - notifiers no longer trash the display.
  1158. @
  1159. text
  1160. @d19 1
  1161. a19 1
  1162. static char rcsid[] = "$Header: /a/newcmds/wish/RCS/wishGather.c,v 1.2 88/11/02 14:50:27 mlgray Exp Locker: mlgray $ SPRITE (Berkeley)";
  1163. @
  1164.  
  1165.  
  1166. 1.2
  1167. log
  1168. @fsflat changed to wish
  1169. @
  1170. text
  1171. @d19 1
  1172. a19 1
  1173. static char rcsid[] = "$Header: wishGather.c,v 1.1 88/10/03 12:47:47 mlgray Exp $ SPRITE (Berkeley)";
  1174. d128 1
  1175. a128 1
  1176.     getAttrsP = FSFLAT_ATTR_NECESSARY_P; 
  1177. d178 1
  1178. d182 1
  1179. d227 1
  1180. d229 2
  1181. a230 2
  1182.             wishErrorMsg, NULL,
  1183.             TRUE, "Continue", NULL);
  1184. d292 1
  1185. a292 1
  1186.     getAttrsP = FSFLAT_ATTR_NECESSARY_P; 
  1187. d331 1
  1188. d335 1
  1189. d431 1
  1190. d434 1
  1191. d477 1
  1192. d480 1
  1193. d485 1
  1194. d489 1
  1195. d494 1
  1196. d497 1
  1197. d1027 1
  1198. a1027 1
  1199.     aWindow->sortingInstructions = FSFLAT_ALPHA_SORT;    /* default */
  1200. d1029 2
  1201. a1030 2
  1202.     if (aWindow->sortingInstructions & FSFLAT_REVERSE_SORT) {
  1203.     if (aWindow->sortingInstructions & FSFLAT_ALPHA_SORT) {
  1204. d1036 1
  1205. a1036 1
  1206.     } else if (aWindow->sortingInstructions & FSFLAT_ATIME_SORT) {
  1207. d1043 1
  1208. a1043 1
  1209.     } else if (aWindow->sortingInstructions & FSFLAT_CTIME_SORT) {
  1210. d1050 1
  1211. a1050 1
  1212.     } else if (aWindow->sortingInstructions & FSFLAT_MTIME_SORT) {
  1213. d1056 1
  1214. a1056 1
  1215.     } else if (aWindow->sortingInstructions & FSFLAT_DTIME_SORT) {
  1216. d1062 1
  1217. a1062 1
  1218.     } else if (aWindow->sortingInstructions & FSFLAT_SIZE_SORT) {
  1219. d1070 1
  1220. a1070 1
  1221.     if (aWindow->sortingInstructions & FSFLAT_ALPHA_SORT) {
  1222. d1076 1
  1223. a1076 1
  1224.     } else if (aWindow->sortingInstructions & FSFLAT_ATIME_SORT) {
  1225. d1083 1
  1226. a1083 1
  1227.     } else if (aWindow->sortingInstructions & FSFLAT_CTIME_SORT) {
  1228. d1090 1
  1229. a1090 1
  1230.     } else if (aWindow->sortingInstructions & FSFLAT_MTIME_SORT) {
  1231. d1096 1
  1232. a1096 1
  1233.     } else if (aWindow->sortingInstructions & FSFLAT_DTIME_SORT) {
  1234. d1102 1
  1235. a1102 1
  1236.     } else if (aWindow->sortingInstructions & FSFLAT_SIZE_SORT) {
  1237. @
  1238.  
  1239.  
  1240. 1.1
  1241. log
  1242. @Initial revision
  1243. @
  1244. text
  1245. @d2 1
  1246. a2 1
  1247.  * fsflatGather.c --
  1248. d19 1
  1249. a19 1
  1250. static char rcsid[] = "$Header: fsflatGather.c,v 1.11 88/06/10 13:14:37 mlgray Exp $ SPRITE (Berkeley)";
  1251. d30 1
  1252. a30 1
  1253. #include "fsflatInt.h"
  1254. d58 1
  1255. a58 1
  1256.  * FsflatGatherNames --
  1257. d72 2
  1258. a73 2
  1259. FsflatGatherNames(aWindow)
  1260.     FsflatWindow    *aWindow;
  1261. d79 2
  1262. a80 2
  1263.     FsflatFile    *tmpPtr, *backTmpPtr;
  1264.     FsflatGroup    *grpPtr;
  1265. d88 2
  1266. a89 2
  1267.     Sx_Panic(fsflatDisplay,
  1268.         "FsflatGatherNames: Should source .wish file, but can't.");
  1269. d92 1
  1270. a92 1
  1271.     FsflatReadRules(aWindow, name);
  1272. d100 1
  1273. a100 1
  1274.     aWindow->groupList = (FsflatGroup *) malloc(sizeof (FsflatGroup));
  1275. d127 1
  1276. a127 1
  1277.     FsflatGetCompareProc(aWindow, &compareProc, FALSE);
  1278. d171 1
  1279. a171 1
  1280.         sprintf(fsflatErrorMsg, "%s %s.  %s %s.  %s %s.",
  1281. d178 2
  1282. a179 2
  1283.         Sx_Notify(fsflatDisplay, aWindow->surroundingWindow, -1, -1, 0,
  1284.             fsflatErrorMsg,
  1285. d188 1
  1286. a188 1
  1287.         tmpPtr = (FsflatFile *) malloc(sizeof (FsflatFile));
  1288. d223 1
  1289. a223 1
  1290.         sprintf(fsflatErrorMsg, "The rule %s contains an error.",
  1291. d225 2
  1292. a226 2
  1293.         Sx_Notify(fsflatDisplay, aWindow->displayWindow, -1, -1, 0,
  1294.             fsflatErrorMsg, NULL,
  1295. d252 2
  1296. a253 2
  1297.     FsflatWindow    *aWindow;
  1298.     FsflatGroup        *grpPtr;
  1299. d260 1
  1300. a260 1
  1301.  * FsflatGatherSingleGroup --
  1302. d274 3
  1303. a276 3
  1304. FsflatGatherSingleGroup(aWindow, grpPtr)
  1305.     FsflatWindow    *aWindow;
  1306.     FsflatGroup        *grpPtr;
  1307. d283 1
  1308. a283 1
  1309.     FsflatFile    *tmpPtr, *backTmpPtr;
  1310. d288 1
  1311. a288 1
  1312.     FsflatGetCompareProc(aWindow, &compareProc, FALSE);
  1313. d321 1
  1314. a321 1
  1315.         sprintf(fsflatErrorMsg, "%s %s.  %s %s.  %s %s.",
  1316. d328 2
  1317. a329 2
  1318.         Sx_Notify(fsflatDisplay, aWindow->surroundingWindow, -1, -1, 0,
  1319.             fsflatErrorMsg,
  1320. d334 1
  1321. a334 1
  1322.     tmpPtr = (FsflatFile *) malloc(sizeof (FsflatFile));
  1323. d409 2
  1324. a410 2
  1325.     FsflatWindow    *aWindow;
  1326.     FsflatGroup        *grpPtr;
  1327. d413 1
  1328. a413 1
  1329.     aWindow = (FsflatWindow *) scanData;
  1330. d424 1
  1331. a424 1
  1332.         sprintf(fsflatErrorMsg, "The rule %s contains an error.",
  1333. d426 2
  1334. a427 2
  1335.         Sx_Notify(fsflatDisplay, aWindow->displayWindow, -1, -1, 0,
  1336.             fsflatErrorMsg, NULL, TRUE, "Continue", NULL);
  1337. d457 1
  1338. a457 1
  1339.     FsflatGroup        *grpPtr;
  1340. d459 1
  1341. a459 1
  1342.     FsflatWindow    *aWindow;
  1343. d468 1
  1344. a468 1
  1345.         sprintf(fsflatErrorMsg, "The rule %s contains an error.",
  1346. d470 2
  1347. a471 2
  1348.         Sx_Notify(fsflatDisplay, aWindow->displayWindow, -1, -1, 0,
  1349.             fsflatErrorMsg, NULL, TRUE, "Continue", NULL);
  1350. d476 1
  1351. a476 1
  1352.     Sx_Notify(fsflatDisplay, aWindow->displayWindow, -1, -1, 0,
  1353. d481 1
  1354. a481 1
  1355.     if (FsflatDoTclSelect(aWindow->interp, grpPtr->rule, entryPtr->d_name,
  1356. d483 1
  1357. a483 1
  1358.     Sx_Notify(fsflatDisplay, aWindow->displayWindow, -1, -1, 0,
  1359. d494 1
  1360. a494 1
  1361.  * FsflatDoTclSelect --
  1362. d511 1
  1363. a511 1
  1364. FsflatDoTclSelect(interp, procName, arg, selectValPtr)
  1365. d675 2
  1366. a676 2
  1367.     FsflatFile    **file1;
  1368.     FsflatFile    **file2;
  1369. d683 2
  1370. a684 2
  1371.     FsflatFile    **file1;
  1372.     FsflatFile    **file2;
  1373. d717 2
  1374. a718 2
  1375.     FsflatFile    **file1;
  1376.     FsflatFile    **file2;
  1377. d725 2
  1378. a726 2
  1379.     FsflatFile    **file1;
  1380.     FsflatFile    **file2;
  1381. d739 1
  1382. a739 1
  1383.     sprintf(fsflatErrorMsg, "Couldn't get attributes for %s.",
  1384. d742 1
  1385. a742 1
  1386.     Sx_Panic(fsflatDisplay, fsflatErrorMsg);
  1387. d745 1
  1388. a745 1
  1389.     sprintf(fsflatErrorMsg, "Couldn't get attributes for %s.",
  1390. d748 1
  1391. a748 1
  1392.     Sx_Panic(fsflatDisplay, fsflatErrorMsg);
  1393. d777 2
  1394. a778 2
  1395.     FsflatFile    **file1;
  1396.     FsflatFile    **file2;
  1397. d785 2
  1398. a786 2
  1399.     FsflatFile    **file1;
  1400.     FsflatFile    **file2;
  1401. d799 1
  1402. a799 1
  1403.     sprintf(fsflatErrorMsg, "Couldn't get attributes for %s.",
  1404. d802 1
  1405. a802 1
  1406.     Sx_Panic(fsflatDisplay, fsflatErrorMsg);
  1407. d805 1
  1408. a805 1
  1409.     sprintf(fsflatErrorMsg, "Couldn't get attributes for %s.",
  1410. d808 1
  1411. a808 1
  1412.     Sx_Panic(fsflatDisplay, fsflatErrorMsg);
  1413. d840 2
  1414. a841 2
  1415.     FsflatFile    **file1;
  1416.     FsflatFile    **file2;
  1417. d848 2
  1418. a849 2
  1419.     FsflatFile    **file1;
  1420.     FsflatFile    **file2;
  1421. d862 1
  1422. a862 1
  1423.     sprintf(fsflatErrorMsg, "Couldn't get attributes for %s.",
  1424. d865 1
  1425. a865 1
  1426.     Sx_Panic(fsflatDisplay, fsflatErrorMsg);
  1427. d868 1
  1428. a868 1
  1429.     sprintf(fsflatErrorMsg, "Couldn't get attributes for %s.",
  1430. d871 1
  1431. a871 1
  1432.     Sx_Panic(fsflatDisplay, fsflatErrorMsg);
  1433. d900 2
  1434. a901 2
  1435.     FsflatFile    **file1;
  1436.     FsflatFile    **file2;
  1437. d908 2
  1438. a909 2
  1439.     FsflatFile    **file1;
  1440.     FsflatFile    **file2;
  1441. d922 1
  1442. a922 1
  1443.     sprintf(fsflatErrorMsg, "Couldn't get attributes for %s.",
  1444. d925 1
  1445. a925 1
  1446.     Sx_Panic(fsflatDisplay, fsflatErrorMsg);
  1447. d928 1
  1448. a928 1
  1449.     sprintf(fsflatErrorMsg, "Couldn't get attributes for %s.",
  1450. d931 1
  1451. a931 1
  1452.     Sx_Panic(fsflatDisplay, fsflatErrorMsg);
  1453. d952 2
  1454. a953 2
  1455.     FsflatFile    **file1;
  1456.     FsflatFile    **file2;
  1457. d960 2
  1458. a961 2
  1459.     FsflatFile    **file1;
  1460.     FsflatFile    **file2;
  1461. d974 1
  1462. a974 1
  1463.     sprintf(fsflatErrorMsg, "Couldn't get attributes for %s.",
  1464. d977 1
  1465. a977 1
  1466.     Sx_Panic(fsflatDisplay, fsflatErrorMsg);
  1467. d980 1
  1468. a980 1
  1469.     sprintf(fsflatErrorMsg, "Couldn't get attributes for %s.",
  1470. d983 1
  1471. a983 1
  1472.     Sx_Panic(fsflatDisplay, fsflatErrorMsg);
  1473. d992 1
  1474. a992 1
  1475.  * FsflatGetCompareProc --
  1476. d997 1
  1477. a997 1
  1478.  *    to FsflatFiles.  Otherwise it takes struct    direct's.
  1479. d1008 2
  1480. a1009 2
  1481. FsflatGetCompareProc(aWindow, compareProcPtr, fileProcP)
  1482.     FsflatWindow    *aWindow;
  1483. @
  1484.